home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / tree / DefaultTreeCellEditor$EditorContainer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.0 KB  |  69 lines

  1. package javax.swing.tree;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dimension;
  7. import java.awt.Graphics;
  8. import java.awt.LayoutManager;
  9.  
  10. public class DefaultTreeCellEditor$EditorContainer extends Container {
  11.    // $FF: synthetic field
  12.    private final DefaultTreeCellEditor this$0;
  13.  
  14.    public DefaultTreeCellEditor$EditorContainer(DefaultTreeCellEditor var1) {
  15.       this.this$0 = var1;
  16.       ((Container)this).setLayout((LayoutManager)null);
  17.    }
  18.  
  19.    public void EditorContainer() {
  20.       ((Container)this).setLayout((LayoutManager)null);
  21.    }
  22.  
  23.    public void doLayout() {
  24.       if (this.this$0.editingComponent != null) {
  25.          Dimension var1 = ((Component)this).getSize();
  26.          this.this$0.editingComponent.getPreferredSize();
  27.          this.this$0.editingComponent.setLocation(this.this$0.offset, 0);
  28.          this.this$0.editingComponent.setBounds(this.this$0.offset, 0, var1.width - this.this$0.offset, var1.height);
  29.       }
  30.  
  31.    }
  32.  
  33.    public Dimension getPreferredSize() {
  34.       if (this.this$0.editingComponent != null) {
  35.          Dimension var1 = this.this$0.editingComponent.getPreferredSize();
  36.          var1.width += this.this$0.offset + 5;
  37.          Dimension var2 = this.this$0.renderer != null ? this.this$0.renderer.getPreferredSize() : null;
  38.          if (var2 != null) {
  39.             var1.height = Math.max(var1.height, var2.height);
  40.          }
  41.  
  42.          if (this.this$0.editingIcon != null) {
  43.             var1.height = Math.max(var1.height, this.this$0.editingIcon.getIconHeight());
  44.          }
  45.  
  46.          var1.width = Math.max(var1.width, 100);
  47.          return var1;
  48.       } else {
  49.          return new Dimension(0, 0);
  50.       }
  51.    }
  52.  
  53.    public void paint(Graphics var1) {
  54.       Dimension var2 = ((Component)this).getSize();
  55.       if (this.this$0.editingIcon != null) {
  56.          int var3 = Math.max(0, (((Component)this).getSize().height - this.this$0.editingIcon.getIconHeight()) / 2);
  57.          this.this$0.editingIcon.paintIcon(this, var1, 0, var3);
  58.       }
  59.  
  60.       Color var4 = this.this$0.getBorderSelectionColor();
  61.       if (var4 != null) {
  62.          var1.setColor(var4);
  63.          var1.drawRect(0, 0, var2.width - 1, var2.height - 1);
  64.       }
  65.  
  66.       super.paint(var1);
  67.    }
  68. }
  69.